package datastructure;
/**
 * A class which represents a patient record.
 * @author ic08jh7
 *
 */


public class PatientRecord {

	private int recordNbr;
	private final String ssn, nurse, division, symptomes, diagnosis;
	private String date, fullName;
/**
 * Creates a patient record with a given information. 
 * Used when a new patient record is created.
 * @param ssn
 * 			the SSN of the patient.
 * @param fullName
 * 			the full name of the patient.
 * @param nurse
 * 			the nurse responsible of the patient.
 * @param division
 * 			the division the patient is located on.
 * @param symptomes
 * 			the symptomes of the patient.
 * @param diagnos
 * 			the diagnos of the patient.
 */
	public PatientRecord(String ssn, String fullName, String nurse,
			String division, String symptomes, String diagnos) {
		this.ssn = ssn;
		this.fullName = fullName;
		this.nurse = nurse;
		this.division = division;
		this.symptomes = symptomes;
		this.diagnosis = diagnos;
		recordNbr = -1;
	}
/**
 * A second constructor used when an exsisting record is fetched from the server.
 * @param ssn
 * 			the SSN of the patient.
 * @param fullName
 * 			the full name of the patient.
 * @param nurse
 * 			the nurse responsible of the patient.
 * @param division
 * 			the division the patient is located on.
 * @param symptomes
 * 			the symptomes of the patient.
 * @param diagnos
 * 			the diagnos of the patient.
 * @param recordNbr
 * 			the number of the record.
 * @param date
 * 			the date the record was issued.
 */
	public PatientRecord(String ssn, String fullName, String nurse,
			String division, String symptomes, String diagnos, int recordNbr,
			String date) {
		this.ssn = ssn;
		this.fullName = fullName;
		this.nurse = nurse;
		this.division = division;
		this.symptomes = symptomes;
		this.diagnosis = diagnos;
		this.recordNbr = recordNbr;
		this.date = date;
	}
/**
 * Sets the record number of the patient record.
 * @param recordNbr
 * 			the new record number.
 */
	public void setRecordNbr(int recordNbr) {
		this.recordNbr = recordNbr;
	}
/**
 * Sets the date of the patient record.
 * @param date
 * 			the new date.
 */
	public void setDate(String date) {
		this.date = date;
	}
/**
 * Sets the name of the patient in the record.
 * @param fullName
 * 			the name of the patient.
 */
	public void setFullName(String fullName) {
		this.fullName = fullName;
	}
/**
 * Returns the record number of the patients.
 * @return
 * 		the record number.
 */
	public int getRecordNbr() {
		return recordNbr;
	}
/**
 * Returns the ssn of the patient.
 * @return
 * 		the ssn.
 */
	public String getSsn() {
		return ssn;
	}
/**
 * Returns the name of the responsible nurse.
 * @return
 * 		the name of the nurse.
 */
	public String getNurse() {
		return nurse;
	}
/**
 * Returns the division the patient is located on.
 * @return
 * 		the division.
 */
	public String getDivision() {
		return division;
	}
/**
 * Returns the symptomes of the patient.
 * @return
 * 		the symptomes.
 */
	public String getSymptomes() {
		return symptomes;
	}
/**
 * Returns the diagnos of the patient.
 * @return
 * 		the diagnos.
 */
	public String getDiagnos() {
		return diagnosis;
	}
/**
 * Returns the date the record was created.
 * @return
 * 		the date.
 */
	public String getDate() {
		return date;
	}
/**
 * Returns the full name of the patient.
 * @return
 * 		the full name.
 */
	public String getFullName() {
		return fullName;
	}

	/**
	 * Creates a string of the record, the string follows 
	 * the data format of the Johansson-Hallberg protocol to the client.
	 * @return
	 *			a string of the patient record.
	 */	
	public String toClientString() {
		return ssn + ":" + fullName + ":" + nurse + ":" + division + ":"
				+ symptomes + ":" + diagnosis + ":" + recordNbr + ":" + date;
	}
	/**
	 * Creates a string of the record, the string follows 
	 * the data format of the Johansson-Hallberg protocol to the server.
	 * @return
	 *			a string of the patient record. 
	 */
	public String toServerString() {
		return ssn + ":" + fullName + ":" + nurse + ":" + division + ":"
				+ symptomes + ":" + diagnosis;
	}

}
